Ext.define('Admin.view.runtime.QueryController', {
			extend : 'Admin.view.runtime.TableChartController',
			alias : 'controller.query',

			metricOfPsrType : function(clz) {
				var me = this, metricStore = me.getStore('metricStore'), extraParams = metricStore.getProxy().extraParams;

				if (extraParams.clz !== clz) {
					extraParams.clz = clz;
					metricStore.reload();
				}
			},

			onRefreshDefault : function(view, record, params) {
				var me = this;
				me.metricOfPsrType(record.data.level);
				me.refreshOfCard(null, null, params);
			},

			getExtraParams : function(interval, params) {
				var vm = this.getViewModel(), record = vm.get('record');
				var extraParams = {
					id : record.data.id,
					level : record.data.level,
					metric : params && params.metric ? params.metric : vm.get('metric'),
					date : Ext.Date.format(params && params.date ? params.date : vm.get('date'), 'Y-m-d'),
					interval : interval ? interval : vm.get('interval')
				};
				return extraParams.metric ? extraParams : null;
			}
		});